import 'package:flutter/material.dart';

class Chapter4Page extends StatelessWidget {
  const Chapter4Page({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: const Text("第四章"),
        leading: IconButton(
          icon: const Icon(Icons.home),
          onPressed: () => Navigator.of(context).pushNamed("/"),
        ),
      ),
      body: SingleChildScrollView(
        child: Center(
          child: Column(
            children: <Widget>[
              SizedBox.fromSize(size: const Size.fromHeight(20)),
              ElevatedButton(
                onPressed: () =>
                    Navigator.of(context).pushNamed("/chapter4/constraints"),
                child: const Text("布局原理与约束"),
              ),
              const SizedBox(height: 20),
              ElevatedButton(
                onPressed: () =>
                    Navigator.of(context).pushNamed("/chapter4/row/column"),
                child: const Text("线性布局（Row和Column）"),
              ),
              const SizedBox(height: 20),
              ElevatedButton(
                onPressed: () =>
                    Navigator.of(context).pushNamed("/chapter4/flex"),
                child: const Text("弹性布局（Flex）"),
              ),
              const SizedBox(height: 20),
              ElevatedButton(
                onPressed: () =>
                    Navigator.of(context).pushNamed("/chapter4/wrap"),
                child: const Text("流式布局（Wrap）"),
              ),
              const SizedBox(height: 20),
              ElevatedButton(
                onPressed: () => Navigator.of(context)
                    .pushNamed("/chapter4/stack/positioned"),
                child: const Text("层叠布局 Stack、Positioned"),
              ),
              const SizedBox(height: 20),
              ElevatedButton(
                onPressed: () =>
                    Navigator.of(context).pushNamed("/chapter4/align"),
                child: const Text("对齐与相对定位（Align）"),
              ),
              const SizedBox(height: 20),
              ElevatedButton(
                onPressed: () =>
                    Navigator.of(context).pushNamed("/chapter4/layout"),
                child: const Text("LayoutBuilder、AfterLayout"),
              ),
              const SizedBox(height: 20),
            ],
          ),
        ),
      ),
    );
  }
}
